<?php

include '../app/common.php';
include '../check.php';

?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>表单页面</title>
    <link href="../component/pear/css/pear.css" rel="stylesheet">
</head>
<body class="pear-container">
<div class="layui-row layui-col-space10">
    <div class="layui-col-md12">

        <div class="layui-card">
            <div class="layui-tab layui-tab-brief" lay-filter="TabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">系统设置</li>
                </ul>


                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <form class="layui-form edit-form" action="" lay-filter="component-form-element">
                            <div class="layui-form-item">
                                <label class="layui-form-label">
                                    网站名称
                                </label>
                                <div class="layui-input-block">
                                    <input autocomplete="off" class="layui-input" name="site_name" value="<?php echo $config['site_name']?>" type="text"/>
                                </div>
                            </div>

                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                  <button type="submit" class="pear-btn pear-btn-normal pear-btn-primary" lay-submit="" lay-filter="configform">保存设置</button>
                                    </div>

                            </div>
                        </form>
                    </div>


                </div>
            </div>

        </div>
    </div>
    <script src="../component/layui/layui.js"></script>
    <script src="../component/pear/pear.js"></script>
    <script>
        layui.use(['form','element','code'], function() {
            var form = layui.form;
            var element = layui.element;
            let $ = layui.jquery;

            layui.code();


            form.on('submit(configform)', function(data) {
                let loading = layer.load();
                $.ajax({
                    url:  "ajax.class.php?act=saveSysSetting",
                    data:JSON.stringify(data.field),
                    dataType:'json',
                    contentType:'application/json',
                    type:'post',
                    success:function(result){
                        layer.close(loading);
                        if (result.code == 1) {
                            layer.msg(result.msg, {
                                icon: 1,
                                time: 1000
                            }, function() {

                            });
                        } else {
                            layer.msg(result.msg, {
                                icon: 2,
                                time: 1000
                            });
                        }
                    }
                })
                return false;
            });

        });
    </script>
</body>
</html>
